<?php

class Category_model extends CI_Model {

    function __construct() {
        parent::__construct();
    }
    
    function getCategory_all() {
        $query = $this->db->order_by("name", "asc")->get('category');

        $arr = array();
        foreach ($query->result() as $row) {
            $arr[] = $row;
        }
        return $arr;
    }    
    
    function getCategory_bySlug($slug) {
        $cate = $this->db->get_where('category', array('slug' => $slug))->row();
        return $cate;
    }
}